<?php
/**
Exibe um formul�rio para a altera��o de uma campus j� cadastrado no banco de dados.
*/

if(!isset($_SESSION))
{
   session_start();
}

if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}

SAEO::ValidarAcesso( array( 0, 2 ) );

$campus = new Campus();
$campiCadastradas = $campus->CarregarCampi(); # carrega do banco de dados todas as campi cadastradas e retorna em um array 
?>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>SAEO - Alteracao de Campus</title>
			<script type='text/javascript' src='templates/hintbox.js'></script>
           	<script type='text/javascript' src='templates/js.js'></script>
           	<script type='text/javascript' src='templates/ajax.js'></script>
           	<script type='text/javascript' src='templates/validacoes.js'></script>
           	<script type='text/javascript' src='templates/campus.js'></script>
           	<script type='text/javascript' src='templates/geral.js'></script>
           	<link rel='stylesheet' type='text/css' href='templates/estilos.css'/>
	</head>
	<body class='body'>
		<form name='alterar_campus' action='EnviarDadosCampus.php?operacao=2' method='post' onsubmit='return ValidarAlteracaoCampus();'>
		<table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
			<tr>
	                <td><?php include "Topo.php"; ?></td>
			</tr>
			<tr>
				<td>
					<div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.jpg)'>ALTERA&Ccedil;&Atilde;O DE UNIDADE</div>
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td>
					<table class='tabela' width='650' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td class='textoTabelas' width='20%'>&nbsp;Unidade:</td>
							<td class='textoTabelas'>
								<select name='campi' class='inputTexto' style='width:300px' onchange='MostrarDiv(this.value, document.getElementById("informacaoCampus")); CarregarCampus(this.value);'>
									<option value='0'>Selecione a unidade</option>";
	                                   <?php 
	                                   	for( $i = 0; $i < count( $campiCadastradas ) ; $i++ )
	                                   	{
	                                    	echo " <option value='".$campiCadastradas[$i]->id."'>".$campiCadastradas[$i]->nome."</option> ";
	                                   	}
										?>
								</select>
								<a href='#' class='hintanchor' onMouseover='showhint("Escolha o campus que deseja alterar.", this, event, "220px");'>[?]</a>
							</td>
						</tr>
						<tr>
							<td colspan='2'>&nbsp;</td>
						</tr>
						<tr>
							<td colspan='2'>
								<div id='informacaoCampus' style='display:none;'>
									<input type='hidden' name='campusId' id='campusId'>
                                    <table class='tabela' width='650' style='border-style: none' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
   										<tr>
											<td class='textoTabelas' width='20%'>&nbsp;Nome: </td>
											<td class='textoTabelas'>
												<input type='text' name='campusNome' id='campusNome' maxlength='255' class='inputTexto' style='width:260'> 
												<a href='#' class='hintanchor' onMouseover='showhint("Nome da Campus.", this, event, "220px");'>[?]</a>
											</td>
										</tr>
										<tr>
											<td colspan='2'>&nbsp;</td>
										</tr>
										<tr>
											<td class='textoTabelas' width='20%'>&nbsp;Respons&aacute;vel: </td>
 											<td class='textoTabelas'>
 												<input type='text' name='campusResponsavel' id='campusResponsavel' maxlength='255' class='inputTexto' style='width:260'> 
 												<a href='#' class='hintanchor' onMouseover='showhint("Respons�vel pela Campus.", this, event, "220px");'>[?]</td>
                                           </tr>
                                           <tr>
                                               <td colspan='2'>&nbsp;</td>
                                           </tr>
                                           <tr>
												<td colspan='2' height='46'>
													<input type='image' style='width:100px;height:30px;position:relative;left:540px' src='templates/btavancar.JPG'/>
												</td>
                                           </tr>
                                    </table>
                               </div>
							</td>
						</tr>
                        <tr>
							<td colspan='2'>&nbsp;</td>
						</tr>
					</table>
				</td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tfoot>
				<tr>
                   <?php include 'rodapeCreditos.php'; ?>
				</tr>
            </tfoot>
     	</table>
		</form>
	</body>
</html>